//
//  UploadErrorLogsViewModel.m
//  YiJuZhangShou2.0
//
//  Created by Sky on 16/5/16.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "UploadErrorLogsViewModel.h"
#import "CoreDataUtil.h"

@implementation UploadErrorLogsViewModel

#pragma mark - Delegate NetworkingBaseManagerAPISuccessCallbackDelegate
- (void)manager:(NetworkingBaseManager *)manager callAPIDidSuccessWithParams:(NSDictionary *)responseParams{
    DDLogInfo(@"查看户型详情网络返回数据：%@",[responseParams description]);
    CoreDataUtil *coreDataUtil = [CoreDataUtil sharedInstance];
    [coreDataUtil deleteLogs:CoreDataErrorLog];
}

#pragma mark - Public
- (void)loadRequest{
    self.manager = [NetworkingManagerFactory generateSHA256Manager];
    RequestGenerator *requestGenerator = [RequestGenerator sharedInstance];
    self.manager.apiName = [requestGenerator generateCommonApiWithName:[NSString stringWithFormat:@"users/%ld/log/error",[AppContext sharedInstance].userId]];
    self.manager.params = self.postObject;
    self.manager.requestType = HTTP_POST;
    self.manager.successDelegate = self;
    self.manager.validator = self;
    [self.manager loadRequest];
}

@end
